/*
 * @(#)RuleService.java 1.0 2010-3-8
 *
 * Copyright 2009 NetQin , Inc. All rights reserved.
 */
package com.netgo.common;

import org.apache.log4j.Logger;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;

import com.netgo.dao.UtilDao;

/**
 * @author wangajing
 * @version 1.0,2010-3-8
 * @see
 * @since 1.0 
 *
 */
public class UtilService {
	private  UtilDao utilDao;
	private MailSender mailSender;
	private Logger logger = Logger.getLogger(this.getClass());
	public UtilDao getUtilDao() {
		return utilDao;
	}

	public void setUtilDao(UtilDao utilDao) {
		this.utilDao = utilDao;
	}
	
	

	public MailSender getMailSender() {
		return mailSender;
	}

	public void setMailSender(MailSender mailSender) {
		this.mailSender = mailSender;
	}

	public String getRuleValue(String ruleID){
		String result;
		if(ruleID!=null){
			result =  utilDao.getRuleValueByID(ruleID);
		} else {
			result = null;
		}
		logger.debug(ruleID+"="+result);
		return result;
	}
	
	public void sendMail(SimpleMailMessage message){
		mailSender.send(message);
	}
}
